import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProConReceiveVO, ProConReceiveForm, ProConReceiveQuery } from '@/api/project/conReceive/types';

/**
 * 查询合同回款记录列表
 * @param query
 * @returns {*}
 */

export const pageProConReceive = (query?: ProConReceiveQuery): AxiosPromise<ProConReceiveVO[]> => {
  return request({
    url: '/pro/conReceive/page',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同回款记录列表（不分页）
 * @param query
 * @returns {*}
 */
export const listProConReceive = (query?: ProConReceiveQuery): AxiosPromise<ProConReceiveVO[]> => {
  return request({
    url: '/pro/conReceive/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同回款记录详细
 * @param id
 */
export const getProConReceive = (id: string | number): AxiosPromise<ProConReceiveVO> => {
  return request({
    url: '/pro/conReceive/' + id,
    method: 'get'
  });
};

/**
 * 新增合同回款记录
 * @param data
 */
export const addProConReceive = (data: ProConReceiveForm) => {
  return request({
    url: '/pro/conReceive',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同回款记录
 * @param data
 */
export const updateProConReceive = (data: ProConReceiveForm) => {
  return request({
    url: '/pro/conReceive',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同回款记录
 * @param id
 */
export const delProConReceive = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pro/conReceive/' + id,
    method: 'delete'
  });
};
